package com.trkj.base.newwork;

import android.content.Context;

import com.trkj.base.Constants;
import com.trkj.base.OnResponseResultListener;

/**
 * 发送POST请求，并有等待提示
 * Created by LiZanhong on 2015/06/22.
 */
public class ProgressBarPostDataFromRemote extends  ProgressBarDataFromRemote {
    public ProgressBarPostDataFromRemote(Context context) {
        super(context);
    }

    public ProgressBarPostDataFromRemote(Context context, OnResponseResultListener responseResultListener) {
        super(context, responseResultListener);
    }

    @Override
    protected String doInBackground(String... params) {
        //判断网络
        if(!NewWorkUtils.isNetworkAvailable(getContext())){
            return Constants.FAILURE_JSON;
        }

        String url = params[0];
        String param = null;
        if(params.length > 1){
            param = params[1];
        }
        String str = getHttpRequest().sendPost(url, param);

        return str;
    }
}
